package com.itheima.app.manager;

import com.itheima.app.interceptor.UserHolder;
import com.itheima.domain.vo.AnswersVo;
import com.itheima.domain.vo.TestResultVo;
import com.itheima.service.db.LingHunService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LingHunManger {
    @DubboReference
    private LingHunService lingHunService;
    public ResponseEntity testSoul() {
        //拿到用户id
        Long userId = UserHolder.getUserId();
        return ResponseEntity.ok(lingHunService.testSoul(userId));
    }
    public void testSoul(List<AnswersVo> answers) {
        //拿到用户id
        Long userId = UserHolder.getUserId();
        lingHunService.testSoul(userId,answers);
    }

    public ResponseEntity report(Long id) {
        Long userId = UserHolder.getUserId();
        TestResultVo testResultVo=lingHunService.report(userId);
        System.out.println("返回的数据:"+testResultVo);
        return ResponseEntity.ok(testResultVo);
    }
}
